let globalData = getApp().globalData;
export const addPrefixToRichText = (richText) => {
  let regex = /<img(.*?)src="([^"]+)"(.*?)>/g;
  let prefixToAdd = globalData.URL
  // 替换图片标签中的 src 属性，添加相同前缀
  let modifiedRichText = richText.replace(regex, function (match, p1, p2, p3) {
    let currentSrc = p2;
    // 添加相同前缀
    let newSrc = prefixToAdd + currentSrc;
    return '<img' + p1 + 'src="' + newSrc + '"' + p3 + '>';
  });
  return modifiedRichText;
}